var e = require;
var t = module;
var o = exports;
var n;
function i(e, t) {
    return (i =
        Object.setPrototypeOf ||
        function (e, t) {
            return (e.__proto__ = t), e;
        })(e, t);
}
(o.__esModule = !0), (o.default = void 0);
var a = (function (e) {
    var t, o;
    function n() {
        return e.call(this) || this;
    }
    (o = e), ((t = n).prototype = Object.create(o.prototype)), (t.prototype.constructor = t), i(t, o);
    var a = n.prototype;
    return (
        (a.init = function () {
            this.env = uc;
        }),
        (a.initAD = function () {}),
        (a.loadBanner = function (e) {
            if (!this.bannerAd) {
                var t = {
                    style: {width: lplatform.cparam.bannerWidth, height: lplatform.cparam.bannerHeight, gravity: 7}
                };
                (this.bannerAd = uc.createBannerAd(t)),
                    this.bannerAd.onLoad(function () {}.bind(this)),
                    this.bannerAd.onError(function () {}.bind(this)),
                    e && this.bannerAd.show();
            }
        }),
        (a.showBanner = function () {
            this.hideBanner(), this.bannerAd ? this.bannerAd.show() : this.loadBanner(!0);
        }),
        (a.hideBanner = function () {
            this.bannerAd && (this.bannerAd.destroy(), (this.bannerAd = null));
        }),
        (a.hideInterstitial = function () {}),
        (a.createRewardedVideo = function (e) {
            lplatform.cparam.rewardedVideoID &&
                (this.rewardedVideoAd ||
                    "function" != typeof this.env.createRewardedVideoAd ||
                    ((this.rewardedVideoAd = this.env.createRewardedVideoAd({
                        adUnitId: lplatform.cparam.rewardedVideoID
                    })),
                    this.rewardedVideoAd.onError(this.onRewardedVideoError.bind(this)),
                    this.rewardedVideoAd.onClose(this.onRewardedVideoClose.bind(this)),
                    this.rewardedVideoAd.onLoad(this.onRewardedVideoLoad.bind(this))),
                e && this.showRewardedVideo(window.vcb));
        }),
        (a.loadRewardedVideo = function (e) {
            this.createRewardedVideo(e), lplatform.plog("loadRewardedVideo this.rewardedVideoAd.load()");
        }),
        (a.onRewardedVideoLoad = function () {
            lplatform.plog("onRewardedVideoLoad this.rewardedVideoIAutoShow:" + this.rewardedVideoIAutoShow);
        }),
        (a.onRewardedVideoError = function (e, t) {
            lplatform.plog("onRewardedVideoError code:" + JSON.stringify(e) + " msg:" + t), this.resetRewardedVideo();
        }),
        (a.onRewardedVideoClose = function (e) {
            if ((lplatform.plog("onRewardedVideoClose res.isEnded:" + e.isEnded), e.isEnded))
                lplatform.plog("onRewardedVideoClose window.vcb:" + window.vcb),
                    window.vcb && window.vcb(e.isEnded),
                    this.resetRewardedVideo(!1, !0),
                    this.loadRewardedVideo(!1);
            else if (lplatform.labData.openSecondTipVideo) {
                var t = this;
                t.env.showModal({
                    title: "继续吗",
                    content: "观看完视频才能获得奖励哦",
                    success: function success(e) {
                        e.confirm
                            ? t.showRewardedVideo(window.vcb)
                            : e.cancel &&
                              (window.vcb && window.vcb(e.isEnded),
                              this.resetRewardedVideo(!1, !0),
                              this.loadRewardedVideo(!1));
                    }
                });
            }
        }),
        (a.showRewardedVideo = function (e) {
            var t = this;
            lplatform.plog("showRewardedVideo vcb:" + e),
                e && (window.vcb = e),
                this.rewardedVideoAd
                    ? (this.showLoading(),
                      (this.rewardedVideoLoadTimeout = setTimeout(
                          function () {
                              lplatform.plog("rewardedVideoLoadTimeout 广告超时 timeMax:" + this.rewardedVideoTimeMax),
                                  clearTimeout(this.rewardedVideoLoadTimeout),
                                  window.vcb && window.vcb(!1, "广告超时"),
                                  this.resetRewardedVideo(!0, !0);
                          }.bind(this),
                          this.rewardedVideoTimeMax
                      )),
                      lplatform.plog("showRewardedVideo this.rewardedVideoIsLoaded:" + this.rewardedVideoIsLoaded),
                      this.rewardedVideoAd
                          .show()
                          .then(function () {
                              lplatform.plog("showRewardedVideo then "),
                                  t.hideLoading(),
                                  clearTimeout(t.rewardedVideoLoadTimeout);
                          })
                          .catch(function (e) {
                              lplatform.plog("showRewardedVideo catch:" + JSON.stringify(e)),
                                  t.hideLoading(),
                                  clearTimeout(t.rewardedVideoLoadTimeout),
                                  t.rewardedVideoAd
                                      .load()
                                      .then(function () {
                                          t.rewardedVideoAd.show();
                                      })
                                      .catch(function () {
                                          t.loadRewardedVideo(!1);
                                      });
                          }))
                    : this.createRewardedVideo(!0);
        }),
        (a.resetRewardedVideo = function (e, t) {
            void 0 === e && (e = !1),
                void 0 === t && (t = !1),
                this.rewardedVideoAd &&
                    e &&
                    (this.rewardedVideoAd.offLoad(this.onRewardedVideoLoad),
                    this.rewardedVideoAd.offError(this.onRewardedVideoError),
                    this.rewardedVideoAd.offClose(this.onRewardedVideoClose),
                    (this.rewardedVideoAd = null)),
                t && (window.vcb = null),
                this.rewardedVideoLoadTimeout && clearTimeout(this.rewardedVideoLoadTimeout),
                this.hideLoading();
        }),
        (a.shareAppMessage = function () {}),
        (a.makeShareUI = function (e, t, o, n, i) {
            void 0 === n && (n = 0), void 0 === i && (i = !1), t && t();
        }),
        (a.analytics = function () {}),
        (a.showFavoriteGuide = function () {}),
        (a.canRecord = function () {
            return !1;
        }),
        (a.canShareRecord = function () {
            return !1;
        }),
        (a.startRecord = function () {}),
        (a.pauseRecord = function () {}),
        (a.resumeRecord = function () {}),
        (a.stopRecord = function () {}),
        (a.shareRecord = function (e, t) {
            t && t();
        }),
        (a.resetRecord = function () {}),
        n
    );
})(((n = e("PTT")) && n.__esModule ? n : {default: n}).default);
(o.default = a), (t.exports = o.default);
